package rtp.servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import rtp.model.TarefaManager;

/**
 * Servlet implementation class CriarTarefaServlet
 */
@WebServlet("/CriarTarefaServlet")
public class CriarTarefaServlet extends HttpServlet {
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		String titulo = request.getParameter("titulo");
		String dtPrazo = request.getParameter("dtPrazo");
		String detalhe = request.getParameter("detalhe");
		String urgente = request.getParameter("urgente");
		String responsavel = request.getParameter("responsavel");

		String msg = TarefaManager.criarTarefa(titulo, dtPrazo, detalhe, urgente, responsavel);

		request.setAttribute("msgStatus", msg);

		RequestDispatcher view = request.getRequestDispatcher("tarefaCriada.jsp");
		view.forward(request, response);
	}

	
}
